﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 静态01
{
    class Program
    {
        // 使用static修饰的成员成为静态成员
        static void Main(string[] args)
        {
            // 对于静态方法，我们可以直接通过类名.方法来调用，只能通过类来调用
            Program.Method01();

            Program p = new Program();
            // 对于普通方法，我们只能通过该类的实例（对象）去调用
            p.Method02();

            Animal ani = new Animal();
            //ani.HuXi();
            //ani.Weight();
            Animal.HuXi();
            Animal.Weight();
            //string str = "asdasd";
            //str.Split();

            Peoson.Money = 100;
            ani.ChangeMoney(10);
            Peoson pp = new Peoson();
            pp.ShowMoney();
        }

        public static void Method01()
        {
            Console.WriteLine("Method01");
        }

        public void Method02()
        {
            Console.WriteLine("Method02");
        }
    }

    class Animal
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public static void HuXi()
        {
            Console.WriteLine("动物会呼吸");
        }
        public static float Weight()
        {
            return 100;
        }

        public void ChangeMoney(int money)
        {
            Peoson.Money += money;
        }
    }

    class Peoson
    {
        public static int Money { get; set; }
       
        public void ShowMoney()
        {
            Console.WriteLine(Money);
        }

    }
}
